{include file="admin/top.php" subject='historyPurchases'}
<div id="content">
    <div id="boxquery">
    <form method="get">
    	<input type="hidden" name="m" value="inventory" />
        <input type="hidden" name="s" value="historyPurchases.php" />
        <input type="hidden" name="id" value="{$smarty.get.id}" />
        <input type="hidden" name="shopid" value="{$smarty.get.shopid}" />
        <input type="hidden" id="order" name="" value="" />
        <input type="submit" id="search" value="查询" class="fr" />
        <li class="yui-skin-sam">入库时间:&nbsp; 
            <input id="sdate" name="sdate" type="text" size="12" value="{$smarty.get.sdate}" onfocus="lockinput(this)" />
            <input id="edate" name="edate" type="text" size="12" value="{$smarty.get.edate|default:$smarty.now|date_format:'%Y-%m-%d'}" onfocus="lockinput(this)" />
            <div id="calContainer" style="display:none; position:absolute;"></div>
        </li>
        <li>供应商:&nbsp;
        <input name="supplier" type="text" id="supplier" value="{$smarty.get.supplier}" size="16" onclick="select()" oninput="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')" onfocus="context_menu_suppliers(this, 'supplierid=[id],supplier=[title]')" />
        <input type="hidden" name="supplierid" id="supplierid" value="{$smarty.get.supplierid}" />
        </li>
        <li>真实采购单价:&nbsp; 
        	<input id="sprice" name="sprice" type="text" size="10" value="{$smarty.get.sprice}" />-
            <input id="mprice" name="mprice" type="text" size="10" value="{$smarty.get.mprice}" />
        </li>
    </form>
    </div>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="lister">
      <tr id="title">
        <td width="40">SKU_ID</td>
        <td>商品图片</td>
        <td>商品名称</td>
        <td>供应商</td>
        <td>采购单价</td>
        <td>货币单位</td>
        <td>数量</td>
        <td>折扣</td>
        <td><a href="javascript:doorder('priceorder','{if $smarty.get.priceorder==desc}asc{else}desc{/if}');">真实采购单价</a></td>
        <td><a href="javascript:doorder('timeorder','{if $smarty.get.timeorder==desc}asc{else}desc{/if}');">入库时间</a></td>
      </tr>
      {historyPurchases limit=20 pager=pager page=$segment.page timeorder=$smarty.get.timeorder priceorder=$smarty.get.priceorder productid=$smarty.get.id shopid=$smarty.get.shopid sdate=$smarty.get.sdate edate=$smarty.get.edate  supplierid=$smarty.get.supplierid sprice=$smarty.get.sprice mprice=$smarty.get.mprice counter=1}
      <tr id="content">
        <td>{$historyPurchases.productid}</td>
        <td><img src="{$historyPurchases.pic}" width="80"></td>
        <td>{$historyPurchases.product}</td>
        <td>{$historyPurchases.supplier}</td>
        <td>{$historyPurchases.pricebuy*1}</td>
        <td>{$historyPurchases.currency_unit}</td>
        <td>{$historyPurchases.number}</td>
        <td>{$historyPurchases.discount}</td>
        <td>{$historyPurchases.realpricebuy}</td>
        <td>{$historyPurchases.timestocked|date_format:"%Y-%m-%d %H:%M:%S"}</td>
      </tr>
      {/historyPurchases}
      {if $pager->rows==0}
      <tr id="content">
        <td colspan="20">&nbsp;</td>
      </tr>
      {/if}
    </table>
    <div id="pager" class="mt10">
        {if $pager}<span class="fr"><strong>合计</strong>: 数量:{$counter.number+0} /&nbsp; 采购均价:{$counter.avgprice+0} /&nbsp; 真实采购均价:{$realcounter.avgprice+0}</span>共{$pager->rows}条记录 第{$pager->pagecurrent}/{$pager->pages}页 {/if} 		
        {if $pager->current > 1}<a href="{url s1=1}">首页</a>{/if}
        {if $pager->current > 1}<a href="{url s1=$pager->current-1}">上页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->current+1}">下页</a>{/if}
        {if $pager->current < $pager->pages}<a href="{url s1=$pager->pages}">尾页</a>{/if}
	</div>
</div>
{include file="admin/bottom.php"}
</body>
</html>
